<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>评论页面</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="css/font.css">
    <link rel="stylesheet" href="css/xadmin.css">
    <link href="lib/layui/css/layui.css" >
    <script type="text/javascript" src="lib/layui/layui.js"
            charset="utf-8"></script>
    <script type="text/javascript" src="js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form" enctype="multipart/form-data" id="form">
            <div class="layui-form-item">
                <label for="content" class="layui-form-label"> <span class="x-red"></span>反馈 </label>
                <div class="layui-input-inline">
                    <input type="text" id="content" name="content" value="" placeholder="添加反馈内容"
                           lay-verify="landMark" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"> 维修结果</label>
                <input type="radio" name="repairRes" value="修好了" title="修好了">
                <input type="radio" name="repairRes" value="没修好" title="没修好">
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">维修费用</label>
                <div class="layui-input-inline">
                    <input type="number" placeholder="请输入本次维修费用     元" name="fee" value="" lay-verify="landMark"
                           autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"> <span class="x-red"></span>请对本次服务评分</label>
                <div class="layui-input-inline">
                    <div id="test1"></div>
                    <input type="hidden" name="score" id="score" readonly>
                </div>
            </div>
            <input type="hidden" id="baoxiudan_id" name="baoxiudan_id" readonly value=""/>
            <div class="layui-form-item">
                <label class="layui-form-label"></label> <label class="layui-form-label"></label>
                <button class="layui-btn" lay-filter="edit" lay-submit="">确定</button>
            </div>
        </form>
    </div>
</div>
<script>layui.use(['form', 'layer', 'jquery', 'rate'],
    function () {
        $ = layui.jquery;
        var form = layui.form;
        var rate = layui.rate;
        //服务评星
        rate.render({
            elem: '#test1',
            half: true,
            choose: function (value) {
                if (value > 3) {
                    layer.alert("感谢您的支持");
                }
                $("#score").val(value);
            }
        });

        var str = window.location.search;
        //拿到保修单编号
        var baoxiudanId = str.substring(1);
        $("#baoxiudan_id").val(baoxiudanId);

        //监听提交
        //反馈按钮事件
        form.on('submit(edit)', function (data) {
            console.log(data.field);
            $.get("addcomment", data.field, function (d) {
                if (d.code == 0) {
                    layer.alert(d.msg);
                    xadmin.close();
                    xadmin.father_reload();
                    return;
                }
                layer.alert(d.msg);
            })
            return false;
        });
    });
</script>

</body>

</html>